/**
 * 
 */
package com.momosw.games.engine.player;

import java.util.List;

import com.momosw.games.engine.Action;
import com.momosw.games.engine.Option;
import com.momosw.games.engine.events.Event;
import com.momosw.games.jericho.board.Card;
import com.momosw.games.jericho.board.WallType;

/**
 * <b>Project:</b> JerichoCardGame<br />
 * <b>Package:</b> com.momosw.games.engine.player<br />
 * <b>Class:</b> ComputerPlayer.java<br />
 * <br />
 * <i>GSI 2011</i><br />
 *
 * @author Miguel Coronado (miguelcb84@gmail.com)
 * @version	Aug 23, 2011
 *
 */
public abstract class ComputerPlayer extends Player{

    public ComputerPlayer (String name) {
        super(name);
    }

    /* (non-Javadoc)
     * @see com.momosw.games.engine.player.Player#notify(java.lang.String)
     */
    @Override
    @Deprecated
    public void notify(String string) {
    }

    /* (non-Javadoc)
     * @see com.momosw.games.engine.player.Player#notify(com.momosw.games.engine.events.Event)
     */
    @Override
    public void notify(Event event) {
    }

    /* (non-Javadoc)
     * @see com.momosw.games.engine.player.Player#chooseBetween(java.util.List)
     */
    @Override
    public Option chooseBetween(List<? extends Option> options) {
        if (options.size() == 1){
            return options.get(0);
        }
        
        Option toInferType = options.get(0);
        if (toInferType instanceof Action) {
            return chooseAction (options);
        }
        
        if (toInferType instanceof Card) {
            return chooseCard (options);
        }
        
        if (toInferType instanceof WallType) {
            return chooseWallType (options);
        }
        
        return null;
    }

    /**
     * Override this method including the rules for making the choice about
     * the action to choose.
     * @param options   This is a list of <code>Actions</code>. There is no 
     *                  need to check it out.
     * @return          The <code>option</code> chosen.
     */
    protected abstract Option chooseAction(List<? extends Option> options);
    
    /**
     * Override this method including the rules for making the choice about
     * the card to choose.
     * @param options   This is a list of <code>Cards</code>. There is no 
     *                  need to check it out.
     * @return          The <code>Option</code> chosen.
     */
    protected abstract Option chooseCard(List<? extends Option> options);
    
    /**
     * Override this method including the rules for making the choice about
     * the wall type to choose.
     * @param options   This is a list of <code>WallTypes</code>. There is 
     *                  no need to check
     * @return          The <code>Option</code> chosen.
     */
    protected abstract  Option chooseWallType(List<? extends Option> options);

}

